package wangm.repository;

import wangm.bean.ExaminationTopic;
import wangm.util.DBOperatorComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;

/**
 * 小题repository(所有查询不写联合查询)
 *
 * @author zk
 * @date 2018-02-23 20:06
 */
@Repository
public class ExaminationTopicRepository {
    private static Logger logger = LoggerFactory.getLogger(ExaminationTopicRepository.class);
    /**
     * this table Name(same as PaperRepository)
     */
    public static final String thisTableName = "T_EXAMINATION_TOPIC";
    /**
     * db operator
     */
    @Autowired
    private DBOperatorComponent dbOperatorComponent;

    /**
     * 根据id查询
     *
     * @param id id
     * @return Bean
     */
    public ExaminationTopic getById(String id){
        try {
            return dbOperatorComponent.getById(id,thisTableName,ExaminationTopic.class);
        } catch (SQLException e) {
            logger.error("query table "+thisTableName+" fail",e);
        }
        return null;
    }
}
